const date = new Date()
const years = []
const months = []
const days = []

for (let i = 1990; i <= date.getFullYear(); i++) {
  years.push(i)
}

for (let i = 1; i <= 12; i++) {
  months.push(i)
}

for (let i = 1; i <= 31; i++) {
  days.push(i)
}
var network = require("../../utils/request.js")
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navIndex : 0,
    showScreen: false,//筛选弹框显示隐藏
    isDate:false,

    years: years,
    year: date.getFullYear(),
    months: months,
    month: 2,
    value: [9999, 1, 1],

    balance:0,
    score:0

  },
 //提现
  withdrawal:function(){
   wx.navigateTo({
     url: '../withdrawal/withdrawal',
   })
  },
  //充值
  topUp:function(){
    wx.navigateTo({
      url: '../topUp/topUp',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let userInfo = app.globalData.userInfo;
    this.setData({
      balance:userInfo.balance,
      score:userInfo.score
    })
  },
  chooseDate:function(){
    this.setData({
      isDate:true
    })
  },
  dateCancel:function(){
    this.setData({
      isDate: false
    })
  },
  dateConfirm:function(){
    this.setData({
      isDate: false
    })
  },

  cancel:function(){
    this.setData({
      showScreen:false
    })
  },
  screenType:function(){
    this.setData({
      showScreen: true
    })
  },
  confirm:function(){
    this.setData({
      showScreen: false
    })
  },
  screenChange: function (e) {
    var index = e.currentTarget.dataset.screenindex
    if (index == this.data.screenIndex) {
      this.setData({
        screenIndex: null
      })
      return false
    }
    this.setData({
      screenIndex: index
    })
    console.log(index)
  },
  chooseNav:function(e){
    var index = e.currentTarget.dataset.index;
    this.setData({
      navIndex:index
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  }
})